export async function updateUser(id, userData) {
    try {
      const response = await fetch(`/api/updata${id}`, {
        method: "PUT",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify(userData),
      });
  
      if (!response.ok) {
        throw new Error("更新用户信息失败");
      }
  
      const updatedUser = await response.json();
      return updatedUser;
    } catch (error) {
      console.error(error);
      throw error;
    }
  }